package com.jprocms.module.cms.es.po;

import com.jprocms.module.cms.es.dto.ContentTxtDto;
import lombok.Data;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Set;

/**
 * @author jprocms
 * es 同步对象
 */
@Data
@Document(indexName = "#{@contentIndex}")
public class EsContent {

    @Field(type = FieldType.Keyword)
    @Id
    private String id;
    @Field(type = FieldType.Text, analyzer = "ik_max_word")
    private String title;
    @Field(type = FieldType.Text, analyzer = "ik_max_word")
    private String subtitle;
    @Field
    private Integer status;
    @Field
    private Long channelId;
    @Field
    private Long siteId;
    @Field(type = FieldType.Text, analyzer = "ik_max_word")
    private String author;
    @Field(type = FieldType.Text, analyzer = "ik_max_word")
    private String createUser;
    @Field
    private Integer createMode;

    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date createTime;


    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date releaseTime;

    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date indexTime;
    @Field
    private Long dictMark;
    @Field
    private Long dictBlock;
    @Field
    private String sysImage;
    @Field
    private String sysVideo;
    @Field
    private String sysAudio;
    @Field
    private String sysAttach;
    @Field
    private String sysAttachName;
    @Field
    private String docPdf;
    @Field
    private String originDoc;
    @Field
    private String docName;
    @Field
    private String description;
    @Field
    private String keywords;
    @Field
    private String source;
    @Field
    private Long modelId;
    @Field
    private Boolean isTop;
    @Field
    private Long topLevel;
    @Field
    private List<Long> tagIds;
    @Field
    private Long originContentId;
    @Field(type = FieldType.Nested)
    private Map<String, Object> customs;
    @Field
    private Integer ups;
    @Field
    private Integer downs;
    @Field
    private Integer comments;
    @Field
    private Integer views;
    @Field
    private Integer downloads;
    @Field
    private Integer favorites;

    @Field(type = FieldType.Nested)
    private List<ContentTxtDto> txts;

    //附件的内容
    @Field(type = FieldType.Nested)
    private List<ContentTxtDto> docs;

    @Field
    private Set<Long> subChannelIds;

    @Field
    private Integer searchWeight = 0;

}
